package com.george.order.controller;

import com.george.order.service.OrderService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * Create By George on /2023/4/10
 * description: 订单相关控制器
 *
 * @author George
 */
@Api(tags = "订单模块")
@RestController
@RequestMapping("/order")
public class OrderController {

    @Resource
    private OrderService orderService;

    @ApiImplicitParams({
            @ApiImplicitParam(name = "userId", value = "用户ID", required = true),
            @ApiImplicitParam(name = "orderId", value = "订单号", required = true)
    })
    @ApiOperation(value = "创建订单")
    @GetMapping("/createOrder/{userId}/{orderId}")
    public String createOrder(@PathVariable("userId") String userId, @PathVariable("orderId") String orderId) {
        orderService.createOrder(userId, orderId);
        return "success";
    }

}
